package com.three.productList.controller;

import com.three.core.entity.FrontUser;
import com.three.core.entity.UserAddress;
import com.three.core.vo.R;
import com.three.productList.feign.FrontUserVipFeign;
import com.three.productList.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：li
 * @date ：Created in 2025/3/18 018 16:38
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/product/car")
public class UserAddressController {
    @Autowired
    private FrontUserVipFeign frontUserVipFeign;

    @Autowired
    private UserAddressService userAddressService;

    //查询当前用户的地址信息
    @PostMapping("/selectAddressById")
    public R<List<UserAddress>> selectAddressById(Integer userId) {
        return userAddressService.selectAddressById(userId);
    }

    //根据电话号码查询当前用户的信息
    @GetMapping("/getUserInfo")
    public R<FrontUser> getUserInfo() {
        R<FrontUser> userInfo = frontUserVipFeign.getUserInfo();
        return new R<>(200, "查询成功", userInfo.getData());
    }
}
